package _03静态变量的应用_在线人数统计;

public class User {
    private String name;
    private String password;
    private static int total;

    public User(String name, String password) {
        this.name = name;
        this.password = password;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public static int getTotal() {
        return total;
    }


    public void login(){
        //登录验证

        System.out.println("登录成功");
        total++;
        System.out.println("当前在线人数："+total);
    }
}
